Skip to content

render: Clean up unused code and duplicate consts#83

Open
adamwg wants to merge 2 commits into
crossplane:mainfrom
adamwg:awg/unused-render-code
Open

render: Clean up unused code and duplicate consts#83
adamwg wants to merge 2 commits into
crossplane:mainfrom
adamwg:awg/unused-render-code

Conversation

@adamwg
Copy link
Copy Markdown
Member

@adamwg adamwg commented Jun 5, 2026

Description of your changes

The coderabbit bot noted on #82 that we're duplicating the
xcrd.AnnotationKeyCompositionResourceName const from crossplane-runtime. The
first commit in this PR removes this duplication.

While digging into the duplicate const, I noticed that we have a bunch of
duplicated consts, which led me to a couple of functions that are exported but
unused since we switched to crossplane internal render. These functions just
duplicate functionality from the real composite controller, so they shouldn't be
necessary for any external consumers of the render code.

I have:

adamwg added 2 commits June 5, 2026 16:03
As noted by the coderabbit bot on crossplane#82, this const is duplicated in the CLI. Use
the version from crossplane-runtime, since it's what Crossplane uses.

Signed-off-by: Adam Wolfe Gordon <[email protected]>
When we switched render to use the high-fidelity engine (`crossplane internal
render`), we left behind some helper functions that are exported but no longer
used. These functions just duplicate functionality from the real composite
controller, so they shouldn't be necessary for any external consumers of the
render code.

Signed-off-by: Adam Wolfe Gordon <[email protected]>
@adamwg adamwg requested review from a team, jcogilvie and tampakrap as code owners June 5, 2026 22:11
@adamwg adamwg requested review from negz and removed request for a team June 5, 2026 22:11
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

Ready to act? Review this PR in Change Stack to turn feedback into patch suggestions you can inspect and refine.

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 67e95514-edc9-4231-b082-b658079e6e06

📥 Commits

Reviewing files that changed from the base of the PR and between 5ed17c9 and b665f70.

📒 Files selected for processing (3)
  • cmd/crossplane/render/render.go
  • cmd/crossplane/render/render_test.go
  • cmd/crossplane/render/xr/cmd.go
💤 Files with no reviewable changes (2)
  • cmd/crossplane/render/render_test.go
  • cmd/crossplane/render/render.go

📝 Walkthrough

Walkthrough

This PR removes exported annotation constants and helper functions (GetSecret, SetComposedResourceMetadata) from the render package and updates error handling in the composed-resource rendering loop to source annotation keys from the xcrd package instead.

Changes

Metadata Helper Removal and Annotation Key Migration

Layer / File(s) Summary
Remove deprecated metadata helpers from render package
cmd/crossplane/render/render.go, cmd/crossplane/render/render_test.go
Imports for meta and resource are removed, exported annotation key constants (AnnotationKeyCompositionResourceName, AnnotationKeyCompositeName, AnnotationKeyClaimNamespace, AnnotationKeyClaimName) are deleted, and the exported helper functions GetSecret and SetComposedResourceMetadata are removed along with their test cases.
Update composed resource error to use xcrd annotation key
cmd/crossplane/render/xr/cmd.go
The composed-resource YAML marshal error now retrieves the resource name using xcrd.AnnotationKeyCompositionResourceName instead of render.AnnotationKeyCompositionResourceName.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • tampakrap
  • negz

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (2 errors)

Check name Status Explanation Resolution
Breaking Changes ❌ Error PR removes 4 exported constants and 2 exported functions from cmd/crossplane/render/render.go without 'breaking-change' label, violating the breaking changes policy. Add 'breaking-change' label to PR or commit message to indicate this is an intentional breaking change to the render package API.
Feature Gate Requirement ❌ Error PR adds new experimental APIs in apis/dev/v1alpha1/ (Project, ProjectSpec, Dependency types) without implementing feature flags to control their use. Implement feature gate checks to conditionally enable the new v1alpha1 APIs, or reconsider whether these should be beta/stable if they don't need gating.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main changes: removing unused code and duplicate constants from the render package.
Description check ✅ Passed The description is directly related to the changeset, explaining the motivation for removing duplicate constants and unused exported functions, and referencing issue #82.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant